package org.ltt.rbac.config.event;

import org.springframework.context.event.EventListener;
import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent;
import org.springframework.security.authentication.event.AuthenticationSuccessEvent;
import org.springframework.stereotype.Component;

/**
 *  认证事件监听器
 *  @Author: dujun
 * @Date: 2020/5/27 10:55
 */
@Component
public class AuthenticationEvents {
    /**
     * 认证成功事件监听
     * @param event
     */
    @EventListener
    public void onSuccess(AuthenticationSuccessEvent event) {
        System.out.println("认证成功！" + event);
    }

    /**
     * 认证失败事件监听
     * @param event
     */
    @EventListener
    public void onFailure(AbstractAuthenticationFailureEvent event) {
        System.out.println("认证失败！" + event);
    }


}
